{extend name="default:layout:base" /}

{block name="main"}
<div class="layui-tab layui-tab-brief" lay-filter="tabBrief">
    {notempty name="tab_nav"}
    <ul class="layui-tab-title" style="margin-bottom: 15px;">
        {foreach $tab_nav['tab_list'] as $k => $vo}
        <li class='{if condition="$k eq $tab_nav.current_tab"} layui-this {/if}' >
            <a href="{$vo['href']}">{$vo['title']}</a>
        </li>
        {/foreach}
    </ul>
    {/notempty}
    <div class="layui-tab-content">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs6">
                <form class="layui-form layui-form-pane">
                    <div class="layui-form-item">
                        <label class="layui-form-label">api地址</label>
                        <div class="layui-input-block">
                            <input type="text" id="api" name="api" required  lay-verify="required" placeholder="请输入api地址" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <a class="layui-btn js-submit layui-btn-normal layui-btn-sm" href="javascript:;">查询</a>
                        </div>
                    </div>
                </form>
            </div>
            <div class="layui-col-xs6">
                <div class="layui-card">
                    <div class="layui-card-header">查询结果</div>
                    <div class="layui-card-body layui-text api-result"></div>
                </div>
                <div>
                    <blockquote class="layui-elem-quote">每个帐号每月共10次清零操作机会，清零生效一次即用掉一次机会，请节省使用。</blockquote>
                    <a class="layui-btn layui-btn-sm js-clear" href="javascript:;">清空quota</a>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['jquery', 'layer'], function(){
        var $ = layui.jquery
        ,layer = layui.layer;

        $('.js-submit').on('click', function () {
            var data = {api: $.trim($('#api').val())};
            if(data.api === ""){
                layer.alert("请输入api地址");
                return false;
            }
            requestPost("", data, function (res) {
                $('.api-result').html(res.data);
            });
        });

        $('.js-clear').on('click', function () {
            layer.confirm("确认操作吗？", function(index){
                var data = {};
                requestPost("", data);
                layer.close(index);
            });
        });
    });
</script>

{/block}